﻿using System;
using System.Web.UI;


namespace mojoPortal.Web.RS.SBM
{
    public partial class RSLocationDetail : RSBasePage
    {
        int _callid = 0;
        int _companyid = 0;
        int _locationid = 0;

        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);
            //Subscribe to this LocationSelected event from ucLocationControl control
            //ucLocationControl.LocationSelected += new LocationControl.SelectLocationCompletedEventHandler(ucLocationControl_LocationSelected);
        }


        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                if (Request.QueryString["action"] == "add")
                    InitializeReadyServicePage("Add New Service Location");
                else
                    InitializeReadyServicePage("Service Location Detail");
                RSUserIdentity userIdentity = GetRSUserIdentity();
                _companyid = userIdentity.RSCompanyId;
                if (Request.QueryString["callid"] != null)
                    _callid = Convert.ToInt32(Request.QueryString["callid"].ToString());
                if (Request.QueryString["locationid"] != null)
                    _locationid = Convert.ToInt32(Request.QueryString["locationid"].ToString());

                ucLocationControl.LoadLocationDataByID(_companyid, _locationid);
            }
        }

        //This is an event handler method.  The event is fired by ucLocationControl control.
        //void ucLocationControl_LocationSelected(object sender, LocationSelectedEventArgs e)
        //{
        //    tcTabs.Visible = true;
        //    ucLocationContactListControl.LoadContactData(e.CompanyId, e.LocationId);
        //    ucAppointmentListControl.LoadAppointmentDataByID(e.CompanyId, e.LocationId);
        //    tcTabs.ActiveTab = tpLocationContact;
        //    hfSelectedLocationId.Value = e.LocationId.ToString();
        //    ucCallListControl.LoadCallDataByLocationID(e.CompanyId, e.LocationId);
        //    ucLocationWorkOrderEstimateListControl.LoadLocationWorkOrderListByID(e.CompanyId, e.LocationId);
        //    ucLocationWorkOrderEstimateListControl.LoadLocationEstimateListByID(e.CompanyId, e.LocationId);
        //    ucLocationInvoiceListControl.LoadInvoiceDataByLocationID(e.CompanyId, e.LocationId);
        //}


    }
}


